{% extends "base_generic.html" %}
{% load widget_tweaks %}

{% block title %}登录 - 本地图书馆{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6 col-lg-5">
        <div class="card shadow-lg border-0">
            <div class="card-header text-white text-center" style="background-color: #d699ff;">
                <h3 class="mb-0"><i class="fas fa-sign-in-alt me-2"></i>用户登录</h3>
            </div>
            <div class="card-body p-4">
                {% if form.errors %}
                    <div class="alert alert-danger" role="alert">
                        <i class="fas fa-exclamation-circle me-2"></i>用户名或密码错误，请重试。
                    </div>
                {% endif %}
                <form method="post" autocomplete="off">
                    {% csrf_token %}
                    <div class="mb-3">
                        <label for="id_username" class="form-label">用户名</label>
                        <div class="input-group">
                            <span class="input-group-text"><i class="fas fa-user"></i></span>
                            {{ form.username|add_class:'form-control' }}
                        </div>
                    </div>
                    <div class="mb-3">
                        <label for="id_password" class="form-label">密码</label>
                        <div class="input-group">
                            <span class="input-group-text"><i class="fas fa-lock"></i></span>
                            {{ form.password|add_class:'form-control' }}
                        </div>
                    </div>
                    <div class="d-grid gap-2">
                        <button type="submit" class="btn btn-primary btn-lg">
                            <i class="fas fa-sign-in-alt me-2"></i>登录
                        </button>
                    </div>
                </form>
                <div class="mt-4 text-center">
                    <a href="{% url 'password_reset' %}" class="text-decoration-none">
                        <i class="fas fa-key me-1"></i>忘记密码？
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_css %}
<style>
    body {
        background: #f2e5ff;
    }
</style>
{% endblock %}

{% block extra_js %}
<!-- 支持Django Widget Tweaks -->
{% endblock %} 